package pack1;

public class java9 {
    public static void main(String[] args){
    double answer1=function1();
    double answer2=function2();
    double answer3=function3();
        System.out.println("answer1"+"="+answer1);
        System.out.println("answer2"+"="+answer2);
        System.out.println("answer3"+"="+answer3);
    }
    public static double function1(){
        double s=0;
        for (double x = 0; x<1;x=x+1e-4) {
            double h=4.0/(1.0+(x*x));
            s=h*(1e-4)+s;
        }
            return s;
    }
    public static double function2(){
        double s=0;
        for (double x = 0; x<1;x=x+1e-4) {
            double h=Math.sin(x)-Math.cos(x);
            s=h*(1e-4)+s;
        }
        return s;
    }
    public static double function3(){
        double s=0;
        for (double x = 0; x<1;x=x+1e-4) {
            for (double y = 0; y<1;y=y+1e-4) {
                double h=x*x+y*y;
                s=h*(1e-4)*(1e-4)+s;
            }
        }
        return s;
    }
}
